﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Resources;

namespace WLS
{
    public partial class Silverlight : Form
    {
        data video;
        all_setting p;

        public Silverlight(data video_, ref all_setting _jazyk)
        {
            InitializeComponent();
            video = video_;
            p = _jazyk;
            p.JazykZmenen += new all_setting.ZmenaJazyku(jazyk_JazykZmenen);
            jazyk_JazykZmenen(p.jazyk);
        }

        /// <summary>
        /// Změní jazyk
        /// </summary>
        /// <param name="jazyk"></param>
        void jazyk_JazykZmenen(string jazyk)
        {
            CultureInfo cultura = CultureInfo.CreateSpecificCulture(jazyk);
            ResourceManager manager = new ResourceManager("WLS.Res", typeof(title).Assembly);
            label2.Text = manager.GetString("name", cultura);
            label1.Text = manager.GetString("description", cultura);
            menuItem1.Text = manager.GetString("back", cultura);
            menuItem2.Text = manager.GetString("add", cultura);
            this.Text = manager.GetString("titleSL", cultura);
            logadd = manager.GetString("logadd", cultura);
            logaddelete = manager.GetString("logaddelete", cultura);
            incorect = manager.GetString("incorect", cultura);
        }
        string logaddelete;
        string logadd;
        string incorect;
        private void silverlight_Load(object sender, EventArgs e)
        {
            if (this.Tag != null) video = (data)this.Tag;
            textBox1.Text = ((silverlights)((data)video).silver).summary.ToString();
            textBox2.Text = ((silverlights)((data)video).silver).filesetname.ToString();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
           this.Close();
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "")
            {
                video.silver = new silverlights(textBox2.Text, textBox1.Text);
                video.nazev = textBox2.Text;
                this.Close();
            }
            else
                MessageBox.Show(incorect);
        }
    }
}